<template>
  <!-- 地址 -->
  <div class="list">
    <div
      class="listBox center"
      @click="goDetilsFn(item)"
      v-for="(item, index) in list"
      :key="index"
    >
      <div class="card">
        <div class="cardTop title aliCenter">
          <div>Warranty Serial Number:{{ item.filmNo }}</div>
          <div></div>
        </div>
        <div class="cardContent">
          <el-row>
            <el-col :span="12" class="col size2">
              <div>First Name:{{ item.ownerFirstName }}</div>
            </el-col>
            <el-col :span="12" class="col size2">
              <div>Last Name:{{ item.ownerLastName }}</div>
            </el-col>
            <el-col :span="12" class="col size2">
              <div>Email:{{ item.ownerEmail }}</div>
            </el-col>
            <el-col :span="12" class="col size2">
              <div>Phone Number:{{ item.ownerFirstName }}</div>
            </el-col>
            <el-col :span="12" class="col size2">
              <div>Product Type:{{ item.filmType }}</div>
            </el-col>
            <el-col :span="12" class="col size2">
              <div>Product Model:{{ item.filmName }}</div>
            </el-col>
            <el-col :span="12" class="col size2">
              <div>Warranty Period:{{ item.filmAge }}</div>
            </el-col>
            <el-col :span="12" class="col size2">
              <div>Store Name:{{ item.storeWorkName }}</div>
            </el-col>
            <el-col :span="12" class="col size2">
              <div>Upload Time:{{ dayjs(item.workTime).format('YYYY-MM-DD') }}</div>
            </el-col>
          </el-row>
        </div>
      </div>
    </div>
    <div class="pageButton center" v-if="total > 0">
      <div>
        <el-icon @click="pageFn(-1)" class="ArrowLeftBold" size="50" color="#ffdd00"
          ><ArrowLeftBold
        /></el-icon>
      </div>
      <div>
        <el-icon @click="pageFn(1)" class="ArrowRightBold" size="50" color="#ffdd00"
          ><ArrowRightBold
        /></el-icon>
      </div>
    </div>
    <div class="listBox center">
      <div class="card">
        <div class="cardTop title aliCenter">
          <div>Tips</div>
          <div></div>
        </div>
        <div class="cardContent">
          <div class="size">
            1.lf only one number is added, the starting number and ending numberwill be the same.<br />2.lf
            batch shipment is needed and the numbers are continuous, onlythe starting number is
            required, Enter the minimum and maximum numbers in the last digit.<br />3.The ending
            number cannot be smaller than the starting number.<br />4.lf the lengths are
            inconsistent or knitted, the lengths of the startingand ending numbers should be the
            same.<br />5.lf the numbers are not continuous, please ship them separately.<br />6.Click
            “Generate Warranty Serial Number" and the system will automaticallygenerate a continuous
            number.
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
import { qualityListSmall2, qualitySerachMy } from '@/http/api/my.js'
import { ref, reactive, onMounted } from 'vue'
import dayjs from 'dayjs'
import { useRouter, useRoute } from 'vue-router'
const router = useRouter()
const route = useRoute()
let dialogVisibleAddressFn = ref(false)
let formData = reactive({})
let query = ref('')
const addVehicleFn = () => {
  dialogVisibleAddressFn.value = true
}
let list = ref([])
let pageData = reactive({
  page: 1,
  size: 10
})
let total = ref(0)
const pageFn = (data) => {
  if (data < 0) {
    if (pageData.page * pageData.size != 10) {
      pageData.page = pageData.page + data == 0 ? 1 : pageData.page + data
      getData()
    }
  } else {
    if (pageData.page * pageData.size <= total.value) {
      pageData.page = pageData.page * pageData.size < total.value ? pageData.page + data : pageData.page
      getData()
    }
  }

}

const getData = async () => {
  let res = ''
  let ownerPhone = JSON.parse(localStorage.getItem('userInfo')).phone
  if (query.value) {
    let data = {
      ownerPhone,
      sherchData: query.value,
      ...pageData

    }
    res = await qualitySerachMy(data)
  } else {

    res = await qualityListSmall2({ ownerPhone, ...pageData })

  }
  total.value = res.total
  list.value = res.res
}
const goDetilsFn = (data) => {
  router.push(`/warranty?id=${data.id}`)
}
onMounted(() => {
  query.value = route.query.serachData
  getData()
})
</script>

<style lang="scss" scoped>
.pageButton {
  margin-top: 20px;
  width: 100%;
}
.storeListRow {
  height: 300px;
  margin-top: 10px;
}
.ArrowLeftBold {
  cursor: pointer;
}
.ArrowRightBold {
  cursor: pointer;
}
.ArrowLeftBold:active {
  color: black;
}
.ArrowRightBold:active {
  color: black;
}
.list {
  min-height: 500px;
}
.listBox {
  width: 100%;
  margin-top: 45px;
  cursor: pointer;
  .card {
    width: 1800px;
    height: 360px;
    border-radius: 20px;
    overflow: hidden;
    background: #1a1c1d;
    .cardTop {
      height: 100px;
      width: 100%;
      background: #ffdd00;
      padding: 0 20px;
      font-weight: bold;
      color: black;
    }
    .cardContent {
      padding: 0 20px;
      font-size: 24px;
      color: white;
      margin-top: 20px;
      .size {
        font-size: 22px;
      }
    }
  }
}
.listBotton {
  width: 100%;
  .botton {
    width: 170px;
    height: 70px;
    background: #ffdd00;
    font-weight: bold;
    font-size: 18px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: black;
    margin-top: 20px;
  }
  .botton:active {
    background: black;
    color: white;
  }
}
.AddVehiclenCard {
  width: 1800px;
  height: 400px;
  border-radius: 20px;
  overflow: hidden;
  background: #1a1c1d;
  .AddVehiclenCardTop {
    height: 100px;
    width: 100%;
    background: #ffdd00;
    font-size: 24px;
    padding: 0 20px;
    font-weight: bold;
    color: black;
  }
}
.AddVehiclenCardContent {
  padding: 10px;
  .left {
    margin-right: 30px;
    margin-left: 50px;
  }
}
.upImg {
  background: #3c3c3c;
  width: 260px;
  height: 260px;
  border-radius: 20px;
  font-size: 50px;
  cursor: pointer;
}

.imgBox {
  width: 260px;
  height: 260px;
  border-radius: 20px;
  position: relative;
  left: 0;
  top: 0;
  img {
    width: 100%;
    height: 100%;
  }
  .Mask {
    background: black;
    opacity: 0;
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    justify-content: space-around;
    font-size: 30px;
  }
  .Mask:hover {
    opacity: 0.6;
  }
  cursor: pointer;
}
::v-deep .el-dialog {
  padding: 0;
  border-radius: 20px;
  width: 1800px;
}
::v-deep .el-dialog__header {
  padding: 0;
}
.bakImg {
  width: 800px;
  height: 800px;
  img {
    width: 100%;
    height: 100%;
  }
}
::v-deep .el-dialog__body2 {
  width: 800px !important;
}
::v-deep .el-form-item__label {
  font-size: 30px;
  color: white;
}
::v-deep .el-radio__input.is-checked .el-radio__inner {
  background: #ffdd00;
  border: #ffdd00;
}
::v-deep .el-radio__input .is-checked {
  color: white !important;
  font-size: 24px;
}
.col {
  width: 100%;
  height: 60px;
}
::v-deep .el-radio__label {
  color: white !important;
  font-size: 24px;
}
::v-deep .el-input {
  height: 40px;
}
::v-deep .el-input__wrapper {
  background: #242424 !important;
  border: 1px solid rgb(255, 221, 0);
  box-shadow: 0 0 !important;
}
.inpute1 {
  width: 800px;
}
.inpute2 {
  width: 1290px;
}
.inpute3 {
  width: 500px;
}

.cofimButton {
  width: 220px;
  height: 70px;
  background: #ffdd00;
  border-radius: 20px;
  font-size: 30px;
  font-weight: bold;
  color: black;
  cursor: pointer;
}
.cofimButton:active {
  background: black;
  color: white;
}
</style>